perm filename MUS10.LCS[UP,DOC]2 blob sn#340972 filedate 1978-03-14 generic text, type T, neo UTF8


IRCAM, PARIS and STANFORD ARTIFICIAL INTELLIGENCE LABORATORY      May 1977


**** DRAFT **** DRAFT **** DRAFT **** DRAFT **** DRAFT **** DRAFT ***









                            Music Manual



                                 by


                                Tovar

                       as edited by Leland Smith





ABSTRACT:

This document describes the compiler/interpeter, MUS10,  used  in the
IRCAM-Stanford Computer Music System.  It includes  a description  of
the language and its use.  MUS10  is a modified version of Stanford's
MUSCMP which is an extended version  of  Stanford's  original   music
program  which  was  written  by David W. Poole.  That program was  a  
descendant of MUSIC IV, written by  Max W. Mathews.
                            Music Manual


                  T A B L E   O F   C O N T E N T S



                               SECTION                           PAGE



Section 1   Introduction

Section 2   Declarations
             2-1     Identifiers .  .  .  .  .  .  .  .  .  .  .  . 6
             2-2     Variable Declaration .  .  .  .  .  .  .  .  . 6
             2-3     Array Declaration .  .  .  .  .  .  .  .  .  . 7
             2-4     Function Declaration .  .  .  .  .  .  .  .  . 8
             2-5     Instrument Declaration  .  .  .  .  .  .  .  . 9

Section 3   Expressions
             3-1     Function Call: .  .  .  .  .  .  .  .  .  .   11
             3-2     Unit Generator Call  .  .  .  .  .  .  .  .   11
             3-3     Array Subscripting   .  .  .  .  .  .  .  .   11

Section 4   Statements
             4-1     Function Call: .  .  .  .  .  .  .  .  .  .   13
             4-2     Unit Generator Call  .  .  .  .  .  .  .  .   13
             4-3     Assignment Statement .  .  .  .  .  .  .  .   14
             4-4     WHILE Statement   .  .  .  .  .  .  .  .  .   14
             4-5     UNTIL Statement   .  .  .  .  .  .  .  .  .   14
             4-6     FOR Statement  .  .  .  .  .  .  .  .  .  .   15
             4-7     PRINT Statement   .  .  .  .  .  .  .  .  .   15
             4-8     Block .  .  .  .  .  .  .  .  .  .  .  .  .   16
             4-9     RETURN Statement  .  .  .  .  .  .  .  .  .   17
             4-10    DONE and EXIT Statements   .  .  .  .  .  .   14

Section 5   Extended Commands					   17

Section 6   Unit Generators
             6-1     Controlled Calling Rates   .  .  .  .  .  .   19
             6-2     VFMULT   .  .  .  .  .  .  .  .  .  .  .  .   19
             6-3     LINEN .  .  .  .  .  .  .  .  .  .  .  .  .   20
             6-4     VALUE .  .  .  .  .  .  .  .  .  .  .  .  .   20
             6-5     The OSCIL family of Unit Generators .  .  .   21
             6-6     The ZOSCIL Family of Unit Generators   .  .   22
             6-7     The RAND Family of Unit Generators  .  .  .   24
             6-8     Reverberators, Delays, and Filters  .  .  .   24

Section 7   Built-in Functions
             7-1     SYNTH .  .  .  .  .  .  .  .  .  .  .  .  .   27

                               Page i
                            Music Manual


             7-2     SEG   .  .  .  .  .  .  .  .  .  .  .  .  .   27
             7-4     SETMAG   .  .  .  .  .  .  .  .  .  .  .  .   28
             7-5     PRINT .  .  .  .  .  .  .  .  .  .  .  .  .   28
             7-6     RDNUM .  .  .  .  .  .  .  .  .  .  .  .  .   29
             7-7     LENGTH   .  .  .  .  .  .  .  .  .  .  .  .   29
             7-8     RAND  .  .  .  .  .  .  .  .  .  .  .  .  .   29
             7-9     INT   .  .  .  .  .  .  .  .  .  .  .  .  .   30

Section 8   Computing sound
             8-1     PLAY Block  .  .  .  .  .  .  .  .  .  .  .   31
             8-2     Instrument Call   .  .  .  .  .  .  .  .  .   32
             8-3     FINISH statement  .  .  .  .  .  .  .  .  .   34

Appendix A  Syntax   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   35

Appendix B  Reserved Words .  .  .  .  .  .  .  .  .  .  .  .  .   37

Appendix C  Predefined Symbols   .  .  .  .  .  .  .  .  .  .  .   38

Appendix D  Error Messages.   .  .  .  .  .  .  .  .  .  .  .  .   40

Appendix E  Some recent improvements   .  .  .  .  .  .  .  .  .   47
Music Manual


                              Section 1
                              _______ _

                            Introduction
                            ____________




The music compiler features a subset of ALGOL with special operations
directed toward music synthesis.  There are three modes  the compiler
can be in.  It can be in  COMPILE mode, where  instrument definitions
are accepted and compiled. It can be in PLAY mode, where it accepts a
note list and invokes these instruments to generate a sound waveform.
If  you  are  not  in  either  COMPILE  or  PLAY  mode,  you  are  in
interpretive mode, where  any ALGOL statements given  get interpreted
on the spot.

Music Manual


                              Section 2
                              _______ _

                            Declarations
                            ____________






2-1. Identifiers
     ___________


<identifier>            ::= <letter>{<alphanumeric>}
<alphanumeric>          ::= <letter>|<number>
<letter>                ::= A|B|C|...Z|_|$|#
<digit>                 ::= 0|1|2|...9


An identifier always  begins with a letter  and may be  followed with
any number of  letters or digits.   There are three  characters which
are treated as letters, $, # and _.  Lower case letters are converted
                        _  _     _
to upper case.  Certain  identifiers have special meanings  which may
not be used as names for variables, functions, arrays or instruments.
There  are  two kinds,  P  and U  variables,  which are  of  the form
P<number> and U<number> (see below) and reserved words like  ARRAY or
_             _                                              _____
BEGIN.  A list of reserved words is contained in Section 2.
_____



2-2. Variable Declaration
     ________ ___________


<variable declaration>  ::= VARIABLE <identifier>{,<identifier>};


All  variables must  be declared  before they  are used.   A variable
declaration consists of the reserved word VARIABLE followed by a list
of identifiers to  be declared as  variables.  All variables  must be
declared before they are used.

If variables are to be  used during R-Time (see Section ),  they must
be declared as R-Time variable by preceding each variable name with a
slash in their declaration.
There are certain  variables, P1,P2,P3,..Pn and  U1,U2,U3,...Un which
have special meanings. Pn is the nth element of the P Array, which is
the  list  of  parameters  to  an  instrument.  Within  an instrument
definition, Un is  the output of the  nth unit generator  within that
instrument definition.
Music Manual                                             Declarations


All variables are stored  in floating point representation,  with two
exceptions.  One exception is in function definitions, where the data
types STRING  and INTEGER  are also  allowed, for  compatability with
external FORTRAN callable subroutines.  The second exceptions  are P-
variables, which do  not have a  specific type associated  with them.
This  means they  can  be used  as  variables, arrays,  and  so forth
without regard to type, hence  one must be careful using them  as one
can easily  make the mistake  of using a  number instead of  an array
with most unpredicatable results  (usually causes an ILL MEM  REF, or
                                                     ___ ___  ___
illegal memory reference).

Example:

VARIABLE A,B,/C,D,/RT;  COMMENT Declares A,B,D to be I-Time variables
                                Declares C,RT to be R-Time variables;



2-3. Array Declaration
     _____ ___________


<array declaration>  ::= ARRAY <array decl. list>
<array decl. list>   ::= <variable>[(<constant>)]
                            {,<array decl. list>}|
                         <variable>(<constant>)

All arrays must be declared before they are used and  contain numbers
in floating point  representation.  An array declaration  consists of
the  reserved  word  ARRAY  followed  by  a  list  consisting  of the
identifier followed  by the array  size in parenthesis,  separated by
commas.  If there are several  arrays of the same size, the  size may
be  omitted on  all but  the  last array  of that  size.   Arrays are
currently restricted to  single subscripts and elements  are numbered
from 0 to n-1. Arrays within blocks are not dynamically allocated(1);
they are allocated at compile time, hence they must be a  fixed size.
Take note that arrays are not initialized and may contain practically
anything.

Example:

ARRAY F1,F2,F3(512),BAZ(2000);  COMMENT Declares F1, F2, F3 to be
                                arrays of length 512, BAZ to be an
                                array of length 2000;
Note: Array subscripts  always start with 0  and thus have  a maximum
subscript of one less than  the size of the array.  Thus,  F3[511] is
                                                           _______

_______________________
(1) Dynamic allocation may be implemented in the future.

Music Manual                                             Declarations


the last element of the array F3 defined in the example.  See  Page x
                              __
for details on referencing elements of an array.



2-4. Function Declaration
     ________ ___________

<function declaration>  ::= FUNCTION <identifier>(<formal list>)
                                <function tail>|
                            EXTERNAL FUNCTION <identifier>
                                (<formal list>)
<formal list>           ::= <formal declaration>{,<formal list>}
<formal declaration>    ::= ARRAY <identifier> |
                            INTEGER <identifier>|
                            STRING <identifier> |
                            <identifier>
<function tail>         ::= ; <block> | = <expression>


A  function declaration  defines a  function in  MUSCMP.   A function
takes from 0 to n  arguments, which may be variables,  arrays, string
constants or expressions and returns a value, which is a real number.
Functions are executed at  either I-time or R-time, depending  on the
arguments at the time they are called (see Page ).

The function declaration includes a list of formal  parameters, which
represent  their respective  actual  arguments when  the  function is
called.  The formal parameters are local variables in terms of scope,
that  is they  are  known only  within  the function  which  they are
declared.  Their use  outside that  function will  have one  of three
results.  If the  variable is not  defined outside that  function, an
error message will be issued.  If it is defined to be of  a different
type, an  error message will  also be issued,  except in a  PLAY list
where type checking is not  as stringent (for details, see  Page 31).
If it  is defined outside  the function  to be of  the same  type, no
error message  will occur, the  result is likely  not to be  what was
intended.
Functions are always called  by reference(1), which means that  if an
assignment  is done  to one  of the  formal parameters,  the argument
itself will be modified.  Such assignments are  strongly discouraged,
since if the function is  called with a constant as an  argument, the
constant's value will be  changed, which usually has  disastorous and
mysterious results!

There are three  forms of function  declaration.  In the  first form,

_______________________
(1) This is the standard  FORTRAN IV calling sequence on the PDP-10.

Music Manual                                             Declarations


the value of the function is the value of the expression to the right
of the '='.  For example, the following function calculates  the cube
of a number.

FUNCTION CUBE(X) = X * X * X;

PRINT CUBE(2);
8.


The second form is used for more complex functions.  Its value is the
expression part  of the  last RETURN  statement executed  within that
function,  as  there may  be  more  than one  RETURN  statement  in a
function.  For example,   the following function returns  the maximum
amplitude of an waveform contained in an array.  (Note that at  IRCAM
the lineprinter always prints the symbol 'left arrow' as an underline.)

FUNCTION AMPLITUDE(ARRAY M);
  BEGIN VARIABLE I,MAX;
    MAX←0;                  COMMENT Initialize maximum amplitude;
    FOR I ← 0 STEP 1 UNTIL LENGTH(M)-1
      DO IF ABS(M[I])>MAX THEN MAX←ABS(M[I]);
                            COMMENT Compare each element with
                                current maximum;
    RETURN MAX;             COMMENT The value of the function is
                                the maximum amplitude found;
    END;

The third form  is used for functions  written in FORTRAN  or machine
code.  It defines the argument list which the function expects to see
and fetchs the address from DDT's symbol table.  This means  that you
must to  use the same  name for  the function as  was written  in the
program or  MUSCMP will not  find its address!   The following  is an
example of this form of declaration.

EXTERNAL FUNCTION SQRT(X);


WARNING:  The syntax for formal declaration may be changed someday to
conform to ALGOL.



2-5. Instrument Declaration
     __________ ___________

<instrument declaration>::= INSTRUMENT <identifier>;
                            <declaration list>;<statement list>



Music Manual


                              Section 3
                              _______ _

                             Expressions
                             ___________



<expression>    ::= <simple expr><relop><simple expr>|<simple expr>
<simple expr>   ::= <term>|<term><addop><simple expr>
<term>          ::= <factor>|<factor><mulop><term>
<factor>        ::= <primary>
<primary>       ::= -<primary>|(<expression>)|<function call>|
                    <unit generator call>|<variable>←<expression>|
                    <variable>|<array ref>|<constant>
<array ref>     ::= <array name>[<expression>]
<relop>         ::= <|=|>|α≤|}|≥
<addop>         ::= +|-
<mulop>         ::= *|/


Expressions are like algebraic formulae with certain changes required
so that they may  be typed on a  keyboard.  For example, '*'  is used
instead of 'x' and '/'  has been used to indicate division.   The use
of parenthesis is similar, but the following:

                3+4x5
                 7x2

should be  written as (3+4*5)/(7*2),  not 3+4*5/7*2.  When  in doubt,
                      _____________       _________
put in the extra parenthesis.  In mathematical notation, there  is an
implied  multiplication   frequently  used   which  must   be  stated
explicitly in MUSCMP,  therefore 2x+3 should be written as  2*X+3. It
                                                            _____
is  also  necessary  to explicitly  parenthesize  the  arguments  to
functions which would not  be required in mathematical  notation, for
example, sin x should be written as SIN(X).
                                    ______

Relational operators, (as in x >  4) are defined to evaluate to  0 if
false and 1 if true.  One should use care with the operators  '=' and
'}' as  floating point  arithmetic is  not exact(1)  discussion.  For
example:

PRINT 3/5+2/5 = 1;
0


_______________________
(1) See Knuth, The  Art of Computer Programming, Section  4.2.2 (Vol.
               ___  ___ __ ________ ___________
II) if you really want to know about this.
Music Manual                                              Expressions


3-1. Function Call:
     ________ _____


<function call> ::= <function>(<parameter list>)
<parameter list>::= <parameter>,<parameter list>|<parameter>
<parameter>     ::= <expression>|<array>|<string constant>


A function call consists of  the function name followed by a  list of
parameters  separated by  commas  and enclosed  by  parenthesis.  The
effect is  to call  the function  (or subroutine)  with that  list of
parameters.  If the function is  not defined to return a  value, such
as a FORTRAN subroutine, the  value of the function is  undefined and
may be almost anything. For additional information on  functions, see
Page 5.  For descriptions of  the built-in functions  available,  see
Page 25.

Example:

PRINT SQRT(2);

1.414213



3-2. Unit Generator Call
     ____ _________ ____


A unit  generator is a  special kind of  function, as it  may contain
both at I-time and  R-time code and requires  special initialization,
Hence a unit generator call is only legal within an instrument.  Note
that a unit generator call within an expression can not be refered to
by Un.   Only unit generators  used as statements  are counted  for U
   _                                                                _
symbols.  See Section 6.



3-3. Array Subscripting
     _____ ____________


<array ref>     ::= <array name>[<expression>]


One can reference  particular elements of  an array by  following the
array name with the  index in square brackets(1). Thus,  F1[5] refers
                                                         _____

_______________________
(1) Parentheses are also acceptable here.

Music Manual                                              Expressions


to element number 5 in the array F1.  Since arrays are always contain
                                 __
floating point  numbers, the construction  F1[5] represents  a single
                                           _____
floating point number and can be used like a variable.

It is important  to note that arrays start with element number  0 and
thus if an array  F1 is of size n,  the last element of the  array is
                  __
F1[n-1].  For  example, the  following loads an  array, F1,  with one
___                                                     __
cycle of a sine wave:

ARRAY F1(512);
BEGIN VARIABLE I;
  FOR I←0 STEP 1 UNTIL 512-1
    DO F1[I]←SIN(I/512);
  END;


The index, also known as the subscript, is  checked for  being within
range,  with   one  important   exception.   In   instruments,  array
references done at R-Time are not checked for efficiency reasons.  If
an array reference is out of bounds, i.e. less than 0 or greater than
or equal to the array size, a diagnostic is printed.  For example:

I←512;
PRINT F1[I];

Subscript of out bounds for array F1, subscript = 512
??


It should  be noted  that since  number is  stored in  floating point
representation, it must be converted to an integer before referencing
the  array  element.   This conversion  is  accomplished  by  the INT
                                                                  ___
function  (see  Page  28)  and  is  NOT  the  same  as  rounding.  If
multiplication or  division is  done on  floating point  numbers, one
often gets something like 4.99999 instead of 5.0 as a result and when
this is used as a index, it will give the element number 4 instead of
5 as one might naively expect.












Music Manual

                              Section 4
                              _______ _

                             Statements
                             __________



<statement>     ::= <function call>|<unit generator call>|
                    <WHILE statement>|<UNTIL statement>|
                    <FOR statement>|<conditional statement>|
                    <PRINT statement>|<assignment statement>|
                    <RETURN statement>|EXIT|DONE|
                    <block>



4-1. Function Call:
     ________ _____

<function call> ::= <function>(<parameter list>)
<parameter list>::= <parameter>,<parameter list>|<parameter>
<parameter>     ::= <expression>|<array>|<string constant>


A function call consists of  the function name followed by a  list of
parameters  separated by  commas  and enclosed  by  parenthesis.  The
effect is  to call  the function  (or subroutine)  with that  list of
parameters.  If the function returns a value, that value is lost.

Example:

SYNTH(F1);              COMMENT Call the function SYNTH with F1
                                as an argument;



4-2. Unit Generator Call
     ____ _________ ____

<unit generator call> ::= <unit generator>(<parameter list>)|
                <unit generator>[<expression>](<parameter list>)


A unit  generator is a  special kind of  function, as it  may contain
both at I-time and  R-time code and requires  special initialization,
Hence a unit generator call  is only legal within an  instrument. The
value of nth unit generator in an instrument can be refered to by Un.
                                                                  _
Only unit generators used as statements are counted for U symbols, if
                                                        _
a unit generator is used  with an expression it is not  counted.  See
Section 6.

Music Manual                                               Statements


4-3. Assignment Statement
     __________ _________


<assignment statement> ::= <variable>←<expression>

This statement assigns the value of the expression to the variable to
the left of  the '←'  Caution: Assignment  to formal parameters  of a
function can have unexpected results;  see Page 5.

Example:

I←123;          COMMENT Set the value of the variable 'I' to 123;



4-4. WHILE Statement
     _____ _________

<WHILE statement> ::= WHILE <conditional> DO <statement>

A WHILE statement consists of the reserved word WHILE, an expression,
called  the  condition  followed  by  the  reserved  word  DO  and  a
statement.  So long  as the  condition is  true, i.e.  not  zero, the
statement will  be repeated  indefinitely.  Generally,  the statement
affects  part   of  the  condition   and  the   statement  eventually
terminates.

Example:

I←1; WHILE I<1000 DO PRINT(I←2*I);

2. 4. 8. 16. 32. 64. 128. 256. 512. 1024.



4-5. UNTIL Statement
     _____ _________


<UNTIL Statement> ::= DO <statement> UNTIL <conditional>

An  UNTIL  statement  is  like an  WHILE  statement  except  that the
statement is executed before  the condition and loop  terminates when
the  condition is  true.   It consists  of  the reserved  word  DO, a
statement followed by the reserved word UNTIL and an  expression, the
condition.





Music Manual                                               Statements



Example:

I←10; DO PRINT(I←I-1) UNTIL I≤0;

9. 8. 7. 6. 5. 4. 3. 2. 1. 0



4-6. FOR Statement
     ___ _________


<FOR statement> ::= FOR <variable>←<expression> STEP <expression> 
                      UNTIL <expression> DO <statement>

This performs the statement for each value of the variable, beginning
with the expression immediately following the '←' in steps defined by
the second expression until it is greater than the  third expression.
The value  of the variable  will always be  the last value  which was
less than the third  expression.  If the first expression  is greater
than the third expression,  the statement will be  skipped altogether
and the variable unchanged.

Example:

FOR I←0 STEP 2 UNTIL 20 PRINT(I);

0 2. 4. 6. 8. 10. 12. 14. 16. 18. 20.



4-7. PRINT Statement
     _____ _________


<PRINT statement> ::= PRINT <print list>
<print list>      ::= <expression>,<print list>|<expression>|
                      <string constant>,<print list>|
                      <string constant>
This  types each  number or  string in  the print  list.  Numbers are
printed  in free  field format  with a  trailing space.   Strings are
printed  without a  leading  or trailing  space and  may  include any
character.  To enter a double quote, precede it with '≡' and to enter
                                                      _
'≡', put in two consecutive '≡'s.
 _                           _






Music Manual                                               Statements



Example:

PRINT "SQRT(2) = ",SQRT(2);

SQRT(2) = 1.41423



4-8. Block
     _____


<block>            ::= BEGIN <declaration list>;<statement list>
<declaration list> ::= <declaration>;<declaration list>|<declaration>
<statement list>   ::= <statement>;<statement list>|END

A Block  is a  list of  statements, bracketed by the  reserved words,
BEGIN and  END and  separated by  the semicolons.   Anything declared
within a block is a local variable and therefore is not known outside
that block,  but anything which  is declared outside  a block  may be
referenced within that block provided that it has not been redefined.
Thus   variable  names  within  blocks  maybe  chosen  without  being
concerned  with  name  conflicts.   (See  also  discussion  of  local
variables in functions on Page 5.)

Example:

VARIABLE X; X←123; PRINT X;

123.

BEGIN VARIABLE X,Y;  X←456; Y←789;  PRINT X,Y;  END;

456. 789.

PRINT X;

123.

PRINT Y;

ERROR:  UNDEFINED IDENTIFIER    Line = 7 /1
PRINT Y;
       ↑
??




Music Manual                                               Statements


4-9. RETURN Statement
     ______ _________

<RETURN statement> ::= RETURN <expression>

A RETURN statement is only valid within a function definition.  It is
  ______
used to terminate execution of a function and to return as  the value
of that  function, the expression  immediately following  the RETURN.
                                                              ______
There may be more than one RETURN statement in a given function.  See
                           ______
Page 6) for more information and an example.



4-10. DONE and EXIT Statements
      ____ ___ ____ __________

A DONE statement is only valid within a FOR, WHILE, or UNTIL loop and
serves provide an alternative means of terminating execution  of that
loop.  There may be more than one DONE statement in a given loop.  If
two loops are nested, the DONE only finishs from the innermost loop.

An EXIT statement  provides for early  termination of a  block.  Like
the DONE statement, it only exits the innermost block.

DONE statements can appear  in blocks and EXIT statements  can appear
in loops.  In such cases, both the block and the loop are exited.

The following example illustrates several uses of EXIT and DONE

COMMENT Print the first 100 prime numbers;

VARIABLE N,I;

PRINT 2;                        COMMENT Only even prime;
FOR N←3 STEP 2 UNTIL 100 DO     COMMENT Skip the rest of the evens;
  BEGIN
    FOR I←3 STEP 2 UNTIL N DO   COMMENT Try each factor;
      IF N = I*INT(N/I)         COMMENT If it divides evenly, stop;
          THEN EXIT             COMMENT (Exits block and continues
                                        outer FOR);
        ELSE IF N/I<I           COMMENT Don't bother past its square;
          THEN DONE;            COMMENT root. (Exits inner FOR);
    PRINT N;                    COMMENT We found one;
    END;                        COMMENT (of FOR loop);





Music Manual

                              Section 5
                              _______ _

                          Extended Commands
                          ________ ________



These commands may be entered at the top level by preceding them with
an <alt mode> (which is echoed as $).
                                  _

Exit:                        <alt mode>EXIT
____

Return to Monitor.

Play:                        <alt mode>P <integer>
____
Goes directly to the playback subroutine.  
This routine is self-instructional.

Print:                       <altmode>PRINT <expression>;
_____
Prints the value  of the expression. It  used to only be  an extended
command.   It is  now  generalized as  an regular  statement  and the
extended command is considered obsolete. See PRINT Statement  on Page
12.

Reduce Core size:            <alt mode>EXCISE
______ ____ ____

Reduces to the minimum core required.

DDT:                         <alt mode>DDT
___
Starts up RAID or DDT. [Not usually loaded in system version  but may
be in other core images.]


Printing the Symbol Table:   <alt mode><declarator> LIST
________ ___ ______ _____
This lists the contents of  the symbol table.  Please note  that this
does not include symbols in inner blocks.  The following types may be
listed:

        VARIABLE
        FUNCTION
        ARRAY
        INSTRUMENT
        UNIT!GENERATOR
Music Manual


                              Section 6
                              _______ _

                           Unit Generators
                           ____ __________




Consider producing the  sound of a simple  sine wave.  If one  had to
call the sine subroutine for  each sample, it would take a  long time
to  compute a  second  of sound  even  at the  lowest  sampling rate.
Therefore, instead of calculating  the function for every  sample, an
array is  filled with  the values  of the  function.  Then,  for each
sample, the value is read out of the appropriate entry in  the array,
instead of calculating it.   Of course, for many kinds  of functions,
the value  will  not  be  particularly  accurate,  but it  is usually
adequate  for  use in  music.   There are  unit  generators  which do
interpolation,  instead  of a  simple  array lookup,  and  these will
produce accurate enough values for most critical cases.



6-1. Controlled Calling Rates
     __________ _______ _____


In  many  cases,  a  function  does  not  change  rapidly  with time.
Therefore to save computer time, it would be desirable not to have to
call the unit  generator for every sample.   This, which is  called a
controlled  calling  rate,  is  expressed  by  placing   a  bracketed
expression immediately  following the unit  generator name in  a unit
generator call.

Example:

        OSCIL[10](P4,10*MAG/P2,F1);

Calls the unit generator OSCIL every tenth sample, and uses  the same
value for the other nine samples.



6-2. VFMULT
     ______


Argument list:

        1 - Amplitude
        2 - Subscript
        3 - Array

Music Manual                                          Unit Generators


VFMULT multiplies the first  argument times the element of  the array
described by the  second argument. If  the second argument is greater
than the array length, it is reduced by that array length until it is
within the size of the array.



6-3. LINEN
     _____


Argument list:

        1 - Amplitude
        2 - Rise time
        3 - Decay time
        4 - Total time
        5 - Array (length = 384)
        6 - Initial point in array

This function uses a 384 word array in three sections, to generate an
envelope  function with  separate  rise time,  intermediate  time and
decay  time.  The  rise time  and decay  time are  a function  of the
second argument, third argument and the total time.  Their  values in
seconds may be calculated according to the following formula.

To obtain a rise time of .1 seconds and a decay time of .4 seconds,

LINEN(P4,.1,.4,P2,F1,TMP←0);


CAUTION: The  initial point in  array must be  a variable  and should
usually be zero. If it is  a constant, you will clobber the  value of
that  constant  with most  unpredicable  results.   Furthermore, this
variable should be  different for each  unit generator call,  or else
the unit generators will interfere with each other.



6-4. VALUE
     _____


Argument list:

        1 - Expression

VALUE is a special  unit generator which returns its  first parameter
as  its value.   Its  sole reason  for existence is  to  allow R-time


Music Manual                                          Unit Generators


expressions  to be  evaluated with  a controlled  calling  rate.  For
example,
VALUE[100](RV←A*SIN(X));


stores the value of A*SIN(X) into the variable RV every 100 samples.



6-5. The OSCIL family of Unit Generators
     ___ _____ ______ __ ____ __________

OSCIL is short for oscillator. An OSCIL outputs successive  values of
the function (or waveform) stored  in an array.  When it  reaches the
end of that array, it 'wraps around' and starts back at the beginning
of  the array.   The  rate at  which it  moves  down the  array  is a
parameter  called  the  increment,  measured  in  array  elements per
sample,  which  is equal  to  the frequency  times  the  array length
divided  by the  sample rate.  For convenience,  there is  a variable
called MAG which is set to 512/SRATE, 512 being the length  of arrays
used here and SRATE being the sample rate.  Since most functions used
with OSCIL range  between -1 and 1,  there is a parameter  called the
amplitude, by  which the value  of the function  is multiplied  by to
produce the value of unit generator.

The usual order of arguments is:

        1 - Amplitude
        2 - Increment
        3 - Array (length = 512)

The following are the many kinds of OSCIL's:

OSCIL:
_____
OSCIL always starts at the beginning of the array when the instrument
is called and will produce  an error message if a  negative increment
is supplied.  

FOSCIL(faster oscil[slightly])is same but does not check for neg. inc.

NOSCIL:
______
NOSCIL  always  starts  at  the  beginning  of  the  array  when  the
instrument is called and will accept a negative argument.  (Very use-
ful for FM sound.)

COSCIL:
______
COSCIL starts wherever it left off the last time that  instrument was


Music Manual                                          Unit Generators


called.  (If there are more than one COSCIL's in an  instrument, they
do not effect each other.)  COSCIL will accept a negative argument.
(This is needed for legato effects.)

EXPEN:
_____
EXPEN always  starts at  the beginning  of the  array and  instead of
'wrapping around' when it reachs the end, it always returns the final
value upon subsequent calls until the instrument starts a new note.

NOSCA:
_____
Argument list:

        1 - Initial index in array
        2 - Amplitude
        3 - Increment
        4 - Array (length = 512)

INTRP:
_____
Argument list:

        1 - Input A
        2 - Input B
        3 - Increment
        4 - Array (length = 512)

INTRP is an unusual variant of OSCIL which almost deserves to be in a
class of its own.  Like  OSCIL, it scans down the array,  but instead
of multiplying by the amplitude, it interpolates between inputs A and
B.  To be more exact, the output is given by A*X+B*(1-X), where  X is
the array element(1).  The contents  of the array are expected  to be
between 0 and 1 for normal usage.



6-6. The ZOSCIL Family of Unit Generators
     ___ ______ ______ __ ____ __________


The  ZOSCIL  family  interpolates  between  the  two   closest  array
elements, rather that doing a straight lookup.  If it reaches the end
of an  array, it will  interpolate between the  last element  and the
first element, which may produce unexpected (but  consistent) results
for discontinuous functions.  ZOSCIL unit generators are  useful were
higher accuracy or or  smoothness is necessary, as for  Chowning's FM
sounds.  (Be careful  of  using  ZOSCIL  for an envelope.  The inter-
polation from the end of the array back to location  zero  can  cause
problems.)
_______________________
(1) Actually the calculation is done as A+X*(B-A)
                                        _________

Music Manual                                          Unit Generators



The typical paramenter list is:

        1 - Amplitude
        2 - Increment
        3 - Array (length = 51)

The following are the various kinds of ZOSCIL.

ZOSCIL:
______
ZOSCIL always starts at the beginning of the array and will  accept a
negative increment.

CZOSCIL:
_______
CZOSCIL interpolates between  the two closest array  elements, rather
that doing  a straight  lookup.  Like COSCIL,  it starts  wherever it
left off the last time the instrument was called. CZOSCIL will accept
negative increment.

ZEXPEN:
______
ZEXPEN is  like a  EXPEN except ZEXPEN  interpolates between  the two
closest array  elements, rather  that doing  a straight  lookup. Like
EXPEN, instead of 'wrapping around' when it reachs the end, it always
returns  the last value upon subsequent calls.  (Good for single note
envelopes.)

ZOSCA:
_____
Argument list:

        1 - Initial point in array
        2 - Amplitude
        3 - Increment
        4 - Array (length = 512)

ZOSCA is a special form of  ZOSCIL which sets where it starts  in the
array to the value of the first argument.

ZINTRP:
______
Argument list:

        1 - Input A
        2 - Input B
        3 - Increment
        4 - Array (length = 512)



Music Manual                                          Unit Generators


ZINTRP is  like a  INTRP except ZINTRP  interpolates between  the two
closest array elements to get a number to use to  interpolate between
the two inputs!  See description of INTRP on Page 20.



6-7. The RAND Family of Unit Generators
     ___ ____ ______ __ ____ __________


There are  two random  number generators that  are available  as unit
generators.   These are  RANDH and  RANDI. Both  of these  generate a
pseudo-random number  (via the linear  congruential method)  every so
often. The first argument  to these unit generators is  the amplitude
(it will go to plus  and minus that number), and the  second argument
is the  frequency (times MAG,  of course).  RANDH  will get  a random
number and hold it for one period (the time of which is determined by
the second  argument), whereas RANDI  will interpolate  linearly from
this point to the next.

Argument list:

        1 - Amplitude
        2 - Increment

For  example,  the following  will  generate five random  numbers per
second between 440 and 660:

        FREQ←550+RANDH(110,5*MAG);




6-8. Reverberators, Delays, and Filters
     ______________ _______ ___ _______


DELAY - Simple Delay:
_____ _ ______ _____
Argument list:

        1 - Input
        2 - Delay m
        3 - Array (length ≥ m)


REV1 is  the simple  delay.  This means  that an  input fed  into the
delay appears at the output m samples later




Music Manual                                          Unit Generators



REV1 - Comb Filter:
____ _ ____ ______
Argument list:

        1 - Input
        2 - Delay m
        3 - Gain g
        4 - Array (length ≥ m)


REV1   is  the  simple  feed-back   delay  loop,   or   comb  filter.
Mathematically its output is described by:

        Y  = X  + g Y
         n    n      n-m


where X  is the input at time n and Y  is the output at time n.  This
       n                             n
means  that an  input fed  into  the delay  appears at  the  output m
samples later,  and is multiplied  by the gain,  g and fed  back into
delay (and thus will reappear another m samples later).  The gain, g,
has better be less than 1 or the filter will not be stable  (and most
likely generate the error message OUTn too big).(1)
                                  ____ ___ ___

REV2 - All-Pass Reverberator:
____ _ ________ ____________
Argument list:

        1 - Input
        2 - Delay m
        3 - Gain g
        4 - Array (length ≥ m)


REV2 is a first-order  all-pass reverberator.  It is  an optimization
of Schroder's all-pass reverberator(2).  Mathematically its output is
described by:

        Y  = g Y    + X    - g X
         n      n-m    n-m      n

_______________________
(1) For details, Chowning, J.M. et. al., Computer Simulation of Music
                                         ________ __________ __ _____
Instruments  Tones  in Reverberant  Environments,  Stanford  Dept. of
___________  _____  __ ___________  ____________
Music Report No. STAN-M-1, pp. 73-74b, (June 1974)

(2) Schroder, M.R.,  Logan, B.F., Natural Sounding  Reverbaration, J.
Audio Eng. Soc. 9  3, 192, July 1961

Music Manual                                          Unit Generators


where X  is the input at time n and Y  is the output at time  n.  The
       n                             n
all-pass has the property of passing all frequencies equally well and
is  used  for  artificial reverberation.   For  details,  please read
Computer  Simulation  of  Music  Instruments  Tones   in  Reverberant
Environments by John Chowning,  et. al.  (1) Remember that  the gain,
g, had better be  less than 1 or the  filter will not be  stable (and
most likely generate the error message OUTn too big).





































_______________________
(1) Stanford Dept. of Music Report No. STAN-M-1, pp. 47-55, pp. 75-76
(June 1974)

Music Manual


                              Section 7
                              _______ _

                         Built-in Functions
                         ________ _________






7-1. SYNTH
     _____


This is written in the MUSIC  program's  ALGOL  and  is found in the     
initialization file, INIT.IRC.  It  allows  arrays to be loaded with 
the sum and/or product of sine waves.    To  use  SYNTH,  you   must  
dimension an array to the  appropriate size (presently 512) and call 
it with SYNTH(<array name>). You should then input four numbers:

    1) the harmonic (denoted by H),
    2) the amplitude (denoted by A),
    3) the phase angle in degrees (denoted by P), and
    4) a constant with is added to the amplitude (denoted by K).

If K is  greater than 100  then it will  multiply instead of  add the
sine wave described.  It is terminated by the single entry of 999 for
H.




7-2. SEG
     ___


Like SYNTH, this routine  is found in INIT.IRC.  It allows arrays to  
be defined as  line segments.   To use  it, you  first must dimension 
an  array  to  the  appropriate  size (presently 512)   and  call the  
function  with SEG(<array  name>).   It expects input of two  numbers, 
the amplitude  and the position  in the array,  on a scale from  0  to  
100.  It  is terminated by  the entry  of 100  as a position.


There is a version  of SYNTH and SEG which  will save the array  on a
file in a form which may be read by the MUSIC program.  This is in an
external  program called FUNC.  It is mostly self-instructional.  For
details see Leland Smith.


Music Manual                                       Built-in Functions


7-4. SETMAG
     ________



SETMAG  may  be  used to  setup NCHNS, SRATE  (the clock  or sampling
rate), and MAG to their appropriate values.  SETMAG is  activated  by
entering 'SETMAG; n1, n2' where n1 is the number of channels  (NCHNS)
and n2 is the sampling rate (SRATE.).  It then sets MAG to 512/SRATE.
                                                    ___    _________
Available clock rates are 12800 and 25600.  Clock rates less than 100
are  multiplied  by  1000  and to a nearby available rate.  (i.e.  12 
becomes  12800).  The available SRATEs are 8000, 10000, 12800, 16000,
20000, 25600,  32000, 40000, 51200,  64000,  80000,  102400,  128000,
160000, 204800, 256000.



7-5. PRINT
     _____

Argument list:

        1 - Number to be printed

Prints an integer  or floating point  number.  It is  mostly obsolete
and is here for  the use in compatablity  (see Page 12).  For  use in
FORTRAN  programs,  there  is   a  function  called  PNUM   which  is
                                                     ____
approximately equivalent to  PRINT. FORTRAN I/O is  incompatable with
MUSCMP and  attempts to  use it  will result  in various  errors like
ILLEGAL UUO AT XXX The difference in names is because the  name PRINT
would conflict with FORTRAN.









Music Manual                                       Built-in Functions





7-6. RDNUM
     _____

Argument list:

        1 - Variable to recieve number

Inputs a number  from the current  input device.  Returns  a floating
point number.  Callable from ALGOL, (as FORTRAN I/O)  is incompatable
with MUSCMP.



7-7. LENGTH
     ______

Argument list:

        1 - Array or string

Returns the length of a string or array.



7-8. RAND
     ____

Argument list:
        None

Generates pseudo-random numbers between -1 and 1(1).














_______________________
(1) The first time RAND is called, the number returned is  a function
of the time and date.

Music Manual                                       Built-in Functions





7-9. INT
     ___

Argument list:

        1 - Number

Returns the integer part, or to be more precise the  entier function.
For example:

INT(123.456)=123
INT(-123.45)=-124




7-10. FORTRAN Functions
      _______ _________

The following functions are loaded from the FORTRAN Library:

        SQRT(X)            Square root
        _______

        SIN(X)             Sine in radians
        ______
        SIND(X)            Sine in degrees
        _______

        COS(X)             Cosine in radians
        ______
        COSD(X)            Cosine in degrees
        _______

        ALOG(X)            Natural logarithm
        _______
        ALOG10(X)          Logarithm base 10
        _________

        ABS(X)             Absolute value
        ______

                            x
        EXP(X)             e
        ______
Music Manual


                              Section 8
                              _______ _

                           Computing sound
                           _________ _____






8-1. PLAY Block
     ____ _____

<play block>      ::= PLAY; <play list> |
                      PLAY <filespec>; <play list>
<play list>       ::= <instrument call>;<play list>|
                      <statement>;<play list>|
                      FINISH
<instrument call> ::= <instrument><parameter list>
<filespec>        ::= <filename><switches>|
                      <filename>
<switches>        ::= <switch><swiches>|<switch>
<switch>          ::= /BYTESIZE=<number>|
                      /SOUND


The play list specifies  when instruments are started, how  long they
are to  run, and what  paramenters they are  called with.

Music Manual                                          Computing sound


8-2. Instrument Call
     __________ ____


The rest of a PLAY block consists of instrument calls  or statements.
A statement  is as described  in Section 10.   An instrument  call is
much like a function call.  It consists of the name of an instrument,
followed by a list  of parameter (or arguments).  When  an instrument
is called, the paramenters  are placed in corresponding  Pn variables
                                                         _
and  the  initialization  code  of  the  instrument  is  called.  The
initialization  code  saves   the  Pn  variables  and   preforms  any
                                   _
computations  which only  involve  I-time variables  (see  Section ).
The  rest  of the  instrument  code  is not  run  until  a subsequent
instrument call is read and  initialized which does not start  at the
same time, or  a FINISH statement is  seen.  Then each  instrument is
run, one  sample at a  time, until the  next instrument is  to begin.
Then more instrument calls are read until the next one is found which
begins at  a lster  time, and the  cycle is  repeated until  a FINISH
statement is seen and all instruments are finished.  As an instrument
finishes, it is  removed from the list  of instruments to be  run for
each sample.

Example:

Music Manual                                          Computing sound


The following generates  1 second of a  440 Hz sine wave  followed by
1/2 sec. of a  660Hz sine wave. The output goes to a file, MUSIC.MSB,
which is written on DSKM.  

COMMENT Fill array with sine wave;
ARRAY SINETABLE[511];
FOR I←0 STEP 1 UNTIL 511 DO SINETABLE[I]←SIN(2*PI/512);

INSTRUMENT SINE;
  COMMENT Generate simple sine wave.  P4 = Amplitude, P3 = frequency;
  OUTA←OUTA+OSCIL(P4,P3*MAG,SINETABLE);
  END;

COMMENT Now, generate the sound;
PLAY ;
  SIMP 0, 1, 440, 1000;
  SIMP 1, 1/2, 660, 1000;
  FINISH;


Arguments to instruments may be either numbers or array, and one must
be careful to use the right type, as the compiler does not  check for
you!  If you give an array  instead of a number, you will  merely get
meaningless results.  However, if you give a number when an  array is
expected, you will most likely get a message from the moniter such as

?
ERROR IN JOB 31
ILL MEM REF AT USER 7601
↑C
.
The first two parameters in an instrument call have a special meaning
to  MUSIC.   Traditionally the  second  two parameters  are  are also
special meaning, but could be used for any purpose.  The meanings are
as follows:

P1     Begin time  Time  at  which  the  instrument  is  started,  in
                   seconds.
P2     Duration    Length of time instrument will be run, in seconds.
P3     Frequency   Typically  fundemental   frequence  or   pitch  of
                   instrument [optional].
P4     Amplitude   Typically maximum sample  to be generated  by this
                   instrument [optional].

Usually, arguments to instruments which are arrays usually  appear at
the end of an instrument call.  P3 and P4 are  sometimes interchanged
so amplitude is P4 and frequency is P3.


Music Manual                                          Computing sound


Because of the way instruments are compiled, it is not  possible call
the same instrument twice  during same time period.  This  is because
it has only one set of temperary variables.



8-3. FINISH statement
     ______ _________


A  FINISH  statement  terminates   a  PLAY  block.   It   causes  all
   ______
instruments to run  to completion and the  output file to  be closed.
(At IRCAM 'FINI' may be used in place of 'FINISH'.)




































Music Manual


                             Appendix A
                             ________ _

                               Syntax
                               ______




Note:  {<foo>} means there may be from 0 to ∞ occurances of <foo>.

<block>                 ::= BEGIN <declaration list>;<statement list>
<declaration list>      ::= <declaration>;<declaration list>|
                            <declaration>
<statement list>        ::= <statement>;<statement list>|END
<statement>             ::= <function call>|<unit generator call>|
                            <assignment statement>|<block>
                            <WHILE statement>|<UNTIL statement>|
                            <FOR statement>|<conditional statement>|
                            <PRINT statement>
<function call>         ::= <function>(<parameter list>)
<unit generator call>   ::= <unit generator>(<parameter list>)|
                     <unit generator>[<expression>](<parameter list>)
<parameter list>        ::= <parameter>,<parameter list>|<parameter>
<parameter>             ::= <expression>|<array>|<string constant>
<FOR statement>         ::= FOR <variable>←<expression> STEP
                            <expression> UNTIL <expression> DO
                            <statement>
<PRINT statement>       ::= PRINT <print list>
<print list>            ::= <expression>,<print list>|<expression>|
                            <string constant>,<print list>|
                            <string constant>
<WHILE statement>       ::= WHILE <conditional> DO <statement>
<UNTIL statement>       ::= DO <statement> UNTIL <conditional>
<assignment statement>  ::= <variable>←<expression>
<play block>            ::= PLAY; <play list> |
                            PLAY <filespec>; <play list>
<instrument call>       ::= <instrument><parameter list>
<extended commands>     ::= EXIT|P <integer>|PRINT <expression>;|
                            RESET|FREEZE|SPACE|DDT|
                            <declarator> LIST
<declarator>            ::= VARIABLE|ARRAY|FUNCTION|INSTRUMENT|
                            UNIT_GENERATOR
<declaration>           ::= <variable declaration>|
                            <array declaration>|
                            <function declaration>|
                            <instrument declaration>
<variable declaration>  ::= VARIABLE <var. dec. list>
<var. dec. list>        ::= <identifier>,<var. dec. list>|
                            /<identifier>,<var. dec. list>|

Music Manual                                                   Syntax


                            <identifier>|/<identifier>
<array declaration>     ::= ARRAY <array decl. list>
<array decl. list>      ::= <array decl. group>,<array decl. list>|
                            <array decl. group>
<array decl. group>     ::= <variable>,<array decl. group>|
                            <variable>(<constant>)
<function declaration>  ::= FUNCTION <identifier>(<formal list>)
                                <function tail>|
                            EXTERNAL FUNCTION <identifier>
                                (<formal list>)
<formal list>           ::= <formal declaration>{,<formal list>}
<formal declaration>    ::= ARRAY <identifier> |
                            INTEGER <identifier>|
                            STRING <identifier> |
                            <identifier>
<function tail>         ::= ; <block> | = <expression>
<instrument declaration>::= INSTRUMENT <identifier>;
                            <declaration list>;<statement list>
<expression>            ::= <term>|<term><addop><expression>
<term>                  ::= <factor>|<factor><mulop><term>
<factor>                ::= <primary>
<primary>               ::= -<primary>|(<expression>)|<variable>|
                            <function call>|<unit generator call>|
                            <array name>(<expression>)|<constant>
                            <variable>←<expression>
<addop>                 ::= +|-
<mulop>                 ::= *|/
<variable>              ::= <letter><var tail>|<letter>
<var tail>              ::= <alphanumeric><var tail>|<alphanumeric>
<alphanumeric>          ::= <letter>|<number>
<letter>                ::= A|B|C|...Z|_|$|#
<digit>                 ::= 0|1|2|...9













Music Manual


                             Appendix B
                             ________ _

                           Reserved Words
                           ________ _____



ARRAY             EXIT              INTEGER           RPRINT
						      SAVCNT
BEGIN             EXTERNAL          LENGTH            STEP
BITS              FINISH(or FINI)   LIST              STRING
				    NOMSG
COMMENT           FOR               PI                THEN
DONE              FUNCTION          PLAY              UNIT!GENERATOR
DO                I!ONLY            PRINT             UNTIL
ELSE              IF                R!PRINT           VARIABLE
		  INFILE
		  INFIL2
		  INFIL3
		  INFIL4
END               INSTRUMENT        RETURN            WHILE



































Music Manual


                             Appendix C
                             ________ _

                         Predefined Symbols
                         __________ _______



ABS        Function        Returns absolute value of number
ARRBLT     Function        Copies N elements between two arrays
BITS       Variable        Sets the bit size of each sample.
COSCIL     Unit generator  Oscillator which remembers pointer between
                           instrument calls
CZOSCIL    Unit generator  Interpolating version of COSCIL
DEBUGFLAG  Variable        Enables    various    compiler   debugging
                           features
DELAY      Unit Generator  Simple Delay
EXPEN      Unit Generator  Oscillator which doesn't wrap around
INFILE     String	   Input (readin) file name 1.
INFIL2       "               "     "       "    "   2.
INFIL3       "               "     "       "    "   3.
INFIL4       "               "     "       "    "   4.
INT        Function        Returns  integer  part  of  floating point
                           number
INTRP      Unit generator  Interpolator driven by oscillator
LINEN      Unit Generator  Three part oscillator
LSBUF      Variable        Current size of DAC buffer
MAXSMP     Variable        Maximum sample seen
NCHNS      Variable        Number of channels active
NOMSG      Variable        If nonzero, disable compiler messages
NOSCA      Unit generator  Oscillator with starting point given
NOSCIL     Unit Generator  Oscillator    which    accepts    negative
                           increments
OSCIL      Unit generator  Simple oscillator
OUT        Unit Generator  Equivalent to OUTA←OUTA+X
OUT2       Unit Generator  Equivalent  to  FUNCTION  OUT2(X,CH1,CH2);
                                           ________  ________________
                           BEGIN   OUTA←OUTA+X*CH1;  OUTB←OUTB+X*CH2;
                           _____   ________________  ________________
                           END;
                           ____
OUTA       Variable        Output channel A
OUTB       Variable        Output channel B
OUTC       Variable        Output channel C
OUTD       Variable        Output channel D
OUTFILE    String          Output file name specification.
P_ARRAY    Array           P1,P2,P3,...
RAND       Function        Returns a pseduo-random number  between -1
                           and 1
RANDH      Unit generator  Oscillator controlled random  numbers with
                           hold
RANDI      Unit generator  Oscillator controlled random  numbers with
                           interpolation

Music Manual                                       Predefined Symbols


REV1       Unit Generator  Comb Filter (Reverberator)
REV2       Unit Generator  All-Pass Reverberator
REVINIT    Unit generator  If nonzero, reverberator arrays are zeroed
                           when initialized
SRATE      Variable        Sampling rate
SAVCNT     Variable        Number of records written between "saves".
VALUE      Unit generator  Returns its first argument
VFMULT     Unit Generator  Multiplies amplitude by array element
ZEXPEN     Unit Generator  Interpolating   oscillator   without  wrap
                           around
ZINTRP     Unit generator  Interpolator   driven   by   interpolating
                           oscillator
ZOSCA      Unit generator  Interpolating  oscillator   with  starting
                           point given
ZOSCIL     Unit generator  Interpolating oscillator

























Music Manual


                             Appendix D
                             ________ _

                           Error Messages.




A simple statement inside a 'COMPILE' section just wastes space!
It will never be executed.

ARRGH! INIT with WAITBIT gave error return!?!!
Horrible system error. Shouldn't happen

Array expected in function or U.G. call, but number found instead.
Prob. argument to instrument wrong.
Either a  function or  Unit Generator  was called  with a  Pn symbol,
which should have  be an array, but  instead a floating  point number
was found.  This is usually caused by passing a number instead  of an
array  in an  instrument call,  or an  error in  the  instrument with
respect to the numbering of the Pn arguments.

Attempt to call unit generator at I-Time
Unit generators always  run at least  partially in R-Time.   What has
probably happened was that  this unit generator call  somehow managed
to find its way inside  an I!ONLY statement, which can  easily happen
if you leave out an END from the construct I!ONLY BEGIN...

Attempt to do numeric operation on a string!
String comparison not implemented.

Attempt to do numeric operation on a string!
You have given a string to a numeric operator, such as '+', '-', '*',
'/', '>', etc.

Attempt to reference unit generator output at I-Time
Unit generators output values  at R-time, thus at I-time,  the output
of a unit generator is undefined.

Byte size not 12 or 18 bits for DAC
Other byte sizes are not  handled by this device.  Will use  a 12-bit
bytesize anyway (caveat).

C O M P I L E R   E R R O R  ! ! ! Get TOVAR or save this core image
and A COPY OF THE INPUT FILE and leave a message by saying MAIL
TVR!!!
Something  unexpected has  happened  which would  probably  should be
looked at as it is most likely a bug.


Music Manual                                          Error Messages.


Can't INIT DSK!
_____ ____ ____
An unlikely situation.

Can't INIT TTY!
_____ ____ ____
An unlikely situation.

Can't OPEN output file
_____ ____ ______ ____
Usually this means the file is protected or already being written.

Can't expand core!
_____ ______ _____
Could get enough core.  You lose.

Can't expand core
_____ ______ ____

Can't have an R-time statement controlled by an I-time conditional
_____ ____ __ ______ _________ __________ __ __ ______ ___________
The  DO  ...  UNTIL   statement  will  never  terminate   under  such
circumstances.

Can't re-INIT output device.
_____ _______ ______ _______
Someone else it probably using it.

Can't reduce core!
_____ ______ _____
Shouldn't happen.

Can't setup buffers for output
_____ _____ _______ ___ ______
This error is probably due to some change to I/O in system.

DONE statement illegal here
____ _________ _______ ____

Dangling ELSE or extraneous ';' in IF...THEN...ELSE statement
________ ____ __ __________ ___ __ ________________ _________


Music Manual                                          Error Messages.


The statement following the 'THEN' in a IF...THEN...ELSE statement is
terminated by the ELSE and should not have a semicolon after it.

Declarations should be made at start of block
____________ ______ __ ____ __ _____ __ _____
You may continue from this error.

Dimension should be a number
_________ ______ __ _ ______
Dynamic arrays are not implimented.

ERROR IN READING THE BITMAP/DIRECTORY
_____ __ _______ ___ ________________

ERROR IN SETTING UP BUFFER RINGS
_____ __ _______ __ ______ _____

ERROR IN WRITING BITMAP!
_____ __ _______ _______

EXIT statement illegal outside of block
____ _________ _______ _______ __ _____

EXPRESSION TOO COMPLEX, MAY BE A COMPILER BUG
__________ ___ ________ ___ __ _ ________ ___

Expected to find a '←' here
________ __ ____ _ ___ ____
The compiler assumed you had begun an assignment statement.

External functions only, please
________ _________ _____ ______
The compiler does not know about anything else being external.

Forward ref. to unit generator
_______ ____ __ ____ _________
You have most likely referenced the output of a unit  generator which
have  not  been defined  yet.  [If there  are  no Un  symbols  in the
expression, it may be a compiler bug.]

ILLEGAL DEBUGFLAG SETTING
_______ _________ _______
ILLEGAL FILE NAME
_______ ____ ____
ILLEGAL FORMAL PARAMETER
_______ ______ _________
IMPROPER ARRAY PARAMETER
________ _____ _________
IMPROPER STRING PARAMETER
________ ______ _________
INIT failed for that device
____ ______ ___ ____ ______
INPUT ERROR
_____ _____
Music Manual                                          Error Messages.


INTEGERS PRESENTLY ALLOWED ONLY FOR EXTERNAL FUNCTIONS, SORRY
________ _________ _______ ____ ___ ________ __________ _____
Illegal byte size, ignored
_______ ____ _____ _______

Illegal character in number
_______ _________ __ ______
Not a digit or decimal point.

Illegal character
_______ _________
A character was found in file which has no meaning to the compiler.

Illegal declaration
_______ ___________
You  may not  make a  declaration of  type UNIT_GENERATOR,  STRING or
INTEGER.

Illegal primary
_______ _______

Illegal primary
_______ _______
Should be a number, variable, array or function call.
____ ____ _____
Missing '(' after array
_______ ___ _____ _____
You are probably trying to use a array as a variable.  Arrays must be
subscripted.

Missing '(' in array declaration
_______ ___ __ _____ ___________
Missing '(' in function call
_______ ___ __ ________ ____
Missing ')' after array subscript
_______ ___ _____ _____ _________
Missing ')' in array declaration
_______ ___ __ _____ ___________
Missing ')' in expression
_______ ___ __ __________
Unbalanced parentheses or missing operator in expression.

Missing ')' in function definition
_______ ___ __ ________ __________
Missing ')' or too many parameters in function call
_______ ___ __ ___ ____ __________ __ ________ ____
Missing ';' or '=' in function definition
_______ ___ __ ___ __ ________ __________
Missing ';'
_______ ___

Music Manual                                          Error Messages.


Missing ';'
_______ ___
Statements should be terminated with a semicolon

Missing 'BEGIN' in function definition
_______ _______ __ ________ __________
Missing 'DO' in FOR
_______ ____ __ ___
Missing 'END'
_______ _____
Missing 'STEP' in FOR
_______ ______ __ ___
Missing 'THEN'
_______ ______
'THEN' Missing in IF...THEN...ELSE Statement.

Missing 'UNTIL' in FOR
_______ _______ __ ___
Missing 'UNTIL'
_______ _______
UNTIL missing from DO ... UNTIL statement or extraneous ';'.

Missing ']' in unit generator call
_______ ___ __ ____ _________ ____
Missing '←' in FOR
_______ ___ __ ___
Missing DO in WHILE statement
_______ __ __ _____ _________
Missing END
_______ ___
FINISH statement giving inside a block.

Missing External function
_______ ________ ________
Either  an  external  function  was  not  loaded  or  its   name  was
misspelled.

Missing IDENTIFIER
_______ __________
Multiply defined symboi
________ _______ ______
Multiply dimensional array not implimented, sorry
________ ___________ _____ ___ ____________ _____
Multiply dimensioned arrays not implemented
________ ___________ ______ ___ ___________
You may also have confused an array name with a function name.

NEGATIVE INC. TO OSCIL
________ ____ __ _____
OSCIL is not defined to go accept a negative increment however if you
continue from  this error it  will treat this  increment as  a NOSCIL
does.


Music Manual                                          Error Messages.


NOT ALLOWED IN 'PLAY' SECTION
___ _______ __ ______ _______

NUMERIC ARGUMENT REQUIRED HERE
_______ ________ ________ ____
A string was found where a numberic argument was expected.

Negative increment to LINEN
________ _________ __ _____
LINEN  is  undefined for  negative  increments.  The  results  may be
unpredicatable.

Negative increment to ZEXPEN
________ _________ __ ______
ZEXPEN is undefined for  negative increments however if  you contiune
it will treat it like a ZOSCIL.

OUTn too big, clipped
____ ___ ____ _______
Sample  just computed  was  too big  to  represent in  the  byte size
currently being used for  output. This usually is indicative  of some
problem in an instrument.

Output error?
______ ______
Error detected while writing out sample buffer

Parameter number, Pn, too big
_________ _______ ___ ___ ___
The 'n' in 'Pn' is  larger than the number of parameters  allowed for
instrument calls.  This number could be increased upon demand.

R-Time condition for I-Time Statement in WHILE statement
______ _________ ___ ______ _________ __ _____ _________
No R-Time  code was  generated after an  R-Time conditional.    It is
most likely that this will result in an infinite loop!

R-Time conditional for I-time IF-THEN-ELSE statement
______ ___________ ___ ______ ____________ _________
No R-time code was  generated after an R-Time  conditional. Therefore
the IF-THEN statement acts as  if the condition were always  true for
the 'THEN' clause and always false for the 'ELSE' clause!

RETURN statement illegal outside of function definition
______ _________ _______ _______ __ ________ __________
Only functions may return a value.  Use EXIT to leave a block.

STRING REQUIRED HERE
______ ________ ____
Something other  than a  string found  as an  argument to  a function
which expected a string as (one of) its arguments.

Music Manual                                          Error Messages.

Simple variable required here
______ ________ ________ ____
FOR loops expect a simple variable, i.e. not an array.

Storage full!
_______ _____
String too long or missing "
______ ___ ____ __ _______ _
Strings have a limited length.

Subscript out of bounds at compile time.
_________ ___ __ ______ __ _______ _____
You have a subscript  expression which evaluates to a  constant which
is either too large or too small.

This feature can not be used on DEC systems yet. Sorry.
____ _______ ___ ___ __ ____ __ ___ _______ ____ ______
There are  some things you  can do  at Stanford that  you can  not do
elsewhere.

This isn't FORTRASH. Use a '←' assignment next time
____ _____ _________ ___ _ ___ __________ ____ ____
However '=' will be accepted under protest.

Too few arguments in function call
___ ___ _________ __ ________ ____
Too many END statements
___ ____ ___ __________
Too many parameters in function call
___ ____ __________ __ ________ ____
Type mismatch for assignment
____ ________ ___ __________
You are trying to assign a  string to a numeric variable or  a number
to a string variable!

UNDEFINED IDENTIFIER
_________ __________

UNDEFINED IDENTIFIER
_________ __________
An identifier was used before it was declared.

Undefined IDENTIFIER
_________ __________

Unexpected symbol beginning a statement
__________ ______ _________ _ _________
It will be ignored and attempt to continue compilation.

Unimplimented operation
_____________ _________
AND and OR are not implimented.


Music Manual                                          Error Messages.


Unit Generator call illegal outside of instrument definition
____ _________ ____ _______ _______ __ __________ __________
Unit generators  are only to  be used inside  of instruments  as they
require special initialization at I-time.

Unit generator call illegal outside of instrument definition
____ _________ ____ _______ _______ __ __________ __________
Unit generators  are only to  be used inside  of instruments  as they
require special initialization at I-time.

Use of two relational operator is illegal here
___ __ ___ __________ ________ __ _______ ____
The compiler doesn't know  how to deal with expression  like '2>X>9'.
Write it as two conditions.

You are calling an instrument which is already running!
___ ___ _______ __ __________ _____ __ _______ ________
Since the code generated for instruments is non-reentrant, you should
not  call  it with  overlapping  time periods  as  this  will produce
unpredicable  results.  Instead  you  should make  a copy  of  with a
different name  (and different  variable names  if they  are declared
outside that instrument).

You can't subscript an array with a string!
___ _____ _________ __ _____ ____ _ _______
An array can only be subscripted by something that evaluates to  be a
number.



















Music Manual


                             Appendix E
                             ________ _

                    Recent improvements to MUSIC
                         _______ _____ _____




Array elements may  be individually referenced.  This  allows complex
waveforms  to   be  described   by  arbitrarily   complex  mathematic
expression, instead  of the previous  restrictions to  combination of
sine waves or approximation by line segments.

There is a  new set of statements  and block structure  added.  These
statements include  IF,  WHILE,  UNTIL and  FOR statements.   A print
statement  has  been  added  which  allows  literal  strings  so that
messages may be printed as well as numbers, which are now  printed in
floating point notation.  The literal strings  may also be  passed to
functions. In order to  use certain routines in the  FORTRAN Library,
the data type INTEGER has been added but is currently limited  to the
external functions  until type  conversion code can  be added  to the
compiler.

Functions may now be blocks as well as expressions.

To make debugging the  compiler easier, a special debugging  mode has
been added.








                            Music Manual


                              I N D E X

                  (References are to page numbers)


ABS                            30   Function Call              11, 13
Absolute value                 30   Function Declaration            8
All-Pass Reverberator          24
ALOG                           30   identifier                      6
argument                        8   increment                      21
Array Declaration               7   index                          12
Array Subscripting          7, 11   Instrument Call            31, 32
Assignment statement        8, 14   Instrument Declaration          6
BEGIN                          16   INT                            30
BITS                           38   Integer                         7
Block                      16, 17   INTRP                          22

called by reference             8   LENGTH                         29
Comb Filter                    25   LINEN                          20
Controlled Calling Rates       19   LIST                           18
COS                            30   local variable                 16
COSCIL                         21   local variables                 8
Cosine                         30   Logarithm                      30
CZOSCIL                        23
DDT                            18
Declaration            6, 7, 8, 9   
DELAY                          24   NOSCA                          22
                                    NOSCIL                         21
DONE                           17
                                    OSCIL                          21
END                            16
EXCISE                         18   P_Array                         6
EXIT                       17, 18   P-variables                     7
EXP                            30   parameters                  8, 11
EXPEN                          22   Play                           18
Exponent                       30   
Expressions                    11   PRINT                  15, 18, 26
Extended Commands              18   
External                        9
FINISH statement           33, 34   RAND                           29
FOR                        15, 17   RANDH                          24
formal parameter                8   RANDI                          24
FORTRAN                         9   Random numbers                 29
                                    RDNUM                          29

                            Music Manual







Real                            7
Relational operators           10
Reserved Words                 37
RETURN                      9, 17
REV1                           25
REV2                           25

SEE                            28
SEG                            27
SETMAG                         28
Simple Delay                   24
SIN                            30
Sine                           30
Special variables               6
SQRT                           30
Square root                    30
Statement      13, 14, 15, 16, 17
String                      7, 15
subroutine                 11, 13
subscript                      12
Symbol Table                   18
Syntax                     35, 36
SYNTH                          27

U-variables             6, 11, 14
Unit Generator    19, 21, 22, 23,
                       24, 25, 26
Unit Generator Call        11, 13
UNTIL                      14, 17

VALUE                          20
Variable Declaration            6
VFMULT                         19

WHILE                      14, 17

ZEXPEN                         23
ZINTRP                         23
ZOSCA                          23
ZOSCIL                         23